
def list_or_tuple(x):
    return isinstance(x, (list, tuple))

def flatten(sequence, to_expand=list_or_tuple):
    for item in sequence:
        if to_expand(item):
            for subitem in flatten(item, to_expand):
                yield subitem
        else:
            yield item

N = 16
LUN = 20
TSE = 8

M = [ 'M%d:%d' % (n, lun) for lun in range(LUN) + [50, 51] for n in range(N) ]
V = []
for n in xrange(N):
    V.extend( 'AU%04d' % (vol+n*2) for vol in (1, 2) )
    V.extend( 'DB%04d' % (vol+n*TSE) for vol in range(1, TSE+1) )
    V.extend( 'MAU%04d' % (vol+n*2) for vol in (1, 2) )
    V.extend( 'MDB%04d' % (vol+n*TSE) for vol in range(1, TSE+1) )

import itertools
for pair in itertools.izip(V, M):
    print pair

